package com.miroservice.chapter2.pojo;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 自定义实现对phone的验证逻辑
 */
public class PhoneValidator implements ConstraintValidator<Phone,String> {

    /**
     *
     *
     */
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if(value==null||value.trim().length()<12){
            return false;
        }else {
            return true;
        }
    }
}
